package com.zhao.common.aop;

import java.util.Date;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.zhao.integration.DefaultMessageEndpoint;

/**
 * AOP
 * 
 * @author zhaoyongfei
 *
 */
@Aspect
@Component
public class DataAccessAspect {

	protected static final Logger logger = LoggerFactory.getLogger(DefaultMessageEndpoint.class);

	@Before("execution(* com.zhao.data.mapper..*(..))")
	public void doAccessCheck() {
		logger.debug("开始: {}", new Date());
	}

	@After("execution(* com.zhao.data.mapper..*(..))")
	public void doAccessBack() {
		logger.debug("结束: {}", new Date());
	}

	@Before("execution(* com.zhao.data.mapper.AccountMapper.selectByUsername(*)) && args(param)")
	public void beforeSelectByUserName(String param) {
		logger.debug("登录账户: {} | 登录时间: {}", param, new Date());

	}

//	@Before("execution(* com.zhao.actor.DemoActor.onReceive(*)) && args(param)")
//	public void onReceive(String param) {
//
//	}

}